﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace demo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            List<object> list = new List<object>();
            for (int i = 0; i < 4; i++)
            {
                Info info = new Info
                {
                    Title = "标题" + (i + 1).ToString(),
                    Content = "内容" + (i + 1).ToString(),
                    IsShow = i % 2 == 0
                };
                list.Add(info);
            }
            controlDgvPage1.SetDataSource(list, false);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            List<object> list = new List<object>();
            for (int i = 0; i < 4; i++)
            {
                Info info = new Info
                {
                Title="标题"+(i+1).ToString(),
                Content= "内容" + (i + 1).ToString(),
                IsShow=i%2==0
                };
                list.Add(info);
            }
            controlDgvPage1.SetDataSource(list);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            List<object> list = new List<object>();
            for (int i = 100; i < 150; i++)
            {
                Info info = new Info
                {
                    Title = "标题" + (i + 1).ToString(),
                    Content = "内容" + (i + 1).ToString(),
                    IsShow = i % 2 == 0
                };
                list.Add(info);
            }
            controlDgvPage1.SetDataSource(list,false);
        }
    }

    public class Info
    {
        public string Title { get; set; }
        public string Content { get; set; }
        public bool IsShow { get; set; } = false;
    }
}
